<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 不同的班级有不同数量的学生                     控制学生数量
    // 将所有学生的总成绩和 平均分求出来

    var students = parseInt(prompt('请输入学生数量')) 

    var scoreSum = 0, scoreAverage = 0

    for (var i = 1; i <= students; i++) {
      var score = parseInt(prompt('请输入第' + i + '个学生成绩'))

      scoreSum = score + scoreSum
    }

    scoreAverage = scoreSum / students

    console.log('学生总成绩是' + scoreSum, '学生平均分是' + scoreAverage)

  </script>
</body>

</html>